<table class="ctable" id="dsRoom" width="100%">
<?php
session_start();
$user=$_SESSION['username'];
$type_room=$_REQUEST['type_room'];
$date=$_REQUEST['date'];
$start_time=$_REQUEST['start_time'];
$end_time=$_REQUEST['end_time'];
$page=$_REQUEST['page'];
$per_page=$_REQUEST['per_page'];
$per_page=5;
include_once '../../../Model/Room.php';
$room= new Room();
$rs=$room->get_list_room_for_user($type_room,$date,$start_time,$end_time,1,$page,$per_page);
$file='../../../../log/debug/'.date("y-m-d").'.txt';
	$f=fopen($file,'a+');
	if($f){
		fwrite($f,"ROOM_GET_LIST_SUCCESS: ".$user." ".gmdate('Y-m-d H:i:s')."\r");
	}
if($rs!=NULL){
$result='';
$action='';
 for($i=0;$i<count($rs);$i++){
	 	$j=$i+1;
		if($rs[$i][5]==NULL){
			$rs[$i][5]="lib/images/phonghop.jpg";
		}
		$result=$result.'<td width="20%"><div class="subContent">
  		  <a href="javascript:open_room(\''.$rs[$i][0].'\')" ><img src="'.$rs[$i][5].'" style="margin-left: 5%;margin-right: 5%;text-align:center;width:85%;height:120px;"/><br>
		  <font color="#000000">'.$rs[$i][1].'</font></a></div></td>';
		  $action=$action.'<td width="20%" align="center"><a href="javascript:book_room(\''.$rs[$i][0].'\')" title=""><input type="button" value="予約" style="width:80%" class="cbutton"></a></td>';
}
for($i=5;$i>count($rs);$i--){
	$result=$result."<td width='20%'></td>";
}
$result='<tr>'.$result.'</tr><tr height="5px;">'.$action.'</tr>';

echo $result;
if(count($rs)>0){
echo "<script type='text/javascript'>
	$(document).ready(function(){
		get_room_info('".$rs[0][0]."');
	});</script>";
}
}
?>
</table>

